/*
 * Copyright (c)  2016, dabing.io
 * All rights reserved.
 * FavoritesEntity.java 2017-09-16 上午8:48
 */

package com.ueboot.weishop.entity.customer;

import com.ueboot.weishop.entity.IDEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import java.util.Date;

/**
 * 描述:客户的优惠券
 *
 * @author yangkui create on 2017-09-16.
 * @since 1.0
 */
@Data
@NoArgsConstructor
@Entity(name = "WS_CUSTOMER_COUPON")
public class CustomerCouponEntity extends IDEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "WS_CUSTOMER_COUPON")
    @GenericGenerator(name = "WS_CUSTOMER_COUPON", strategy = "enhanced-table", parameters = {
            @org.hibernate.annotations.Parameter(name = "table_name", value = "WS_TABLE_SEQUENCE"),
            @org.hibernate.annotations.Parameter(name = "segment_value", value = "WS_CUSTOMER_COUPON"),
            @org.hibernate.annotations.Parameter(name = "optimizer", value = "pooled")})
    @Column(name = "ID", columnDefinition = "INT(20) COMMENT 'id主键'", length = 20)
    private Long id;
    /**
     * 代金券编号
     */
    @Column(name = "SEQ_NO",columnDefinition = "VARCHAR(200) COMMENT '代金券编号'",length = 200)
    private String seqNo;

    /**
     * 优惠券名称
     */
    @Column(name = "NAME",columnDefinition = "VARCHAR(200) COMMENT '优惠券名称'",length = 200)
    private String name;

    /**
     * VIN
     */
    @Column(name = "VIN",columnDefinition = "VARCHAR(200) COMMENT 'VIN'",length = 200)
    private String vin;

    /**
     * 来源类型（逻辑判断用，界面不显示）
     */
    @Column(name = "SOURCE_TYPE",columnDefinition = "VARCHAR(200) COMMENT '来源类型'",length = 200)
    private String sourceType;

    /**
     * 使用开始日期
     */
    @Column(name = "BEGIN_TIME",columnDefinition = "DATE COMMENT '使用开始日期'")
    private Date beginTime;
    /**
     * 使用结束日期
     */
    @Column(name = "END_TIME",columnDefinition = "DATE COMMENT '使用结束日期'")
    private Date endTime;
    /**
     * 描述信息
     */
    @Column(name = "REMARK",columnDefinition = "VARCHAR(2000) COMMENT '描述信息'",length = 2000)
    private String remark;
    /**
     * 是否启用
     */
    @Column(name = "ENABLED",columnDefinition = "INT(1) COMMENT '是否启用'",length = 1)
    @Type(type= "org.hibernate.type.NumericBooleanType")
    private Boolean enabled;
    /**
     * 使用时最小商品价格
     */
    @Column(name = "MIN_GOODS_PRICE",columnDefinition = "VARCHAR(200) COMMENT '使用时最小商品价格'",length = 200)
    private int minGoodsPrice;
    /**
     * 使用时最大商品价格
     */
    @Column(name = "MAX_GOODS_PRICE",columnDefinition = "VARCHAR(200) COMMENT '使用时最大商品价格'",length = 200)
    private int maxGoodsPrice;

    /**
     * 代金券金额
     */
    @Column(name = "AMOUNT",columnDefinition = "int(11) COMMENT '代金券金额'",length = 11)
    private int amount;

    /**
     * 来源：抽奖|系统发放|代金券活动groupCode
     */
    @Column(name = "SOURCE",columnDefinition = "VARCHAR(200) COMMENT '来源：抽奖|系统发放|代金券活动'",length = 40)
    private String source;
    /**
     * 所属客户
     */
    @ManyToOne
    @JoinColumn(name="CUSTOMER_ID",columnDefinition = "INT(20) COMMENT '所属客户'")
    private CustomerInfoEntity customer;

}